package io;

import java.io.*;

/**
 * 对象流
 * java.io.ObjectOutputStream和OBjectInputStream
 * 对象流是一对高级流，作用序列化反序列化
 */
public class OOSDemo  {
    public static void main(String[] args) throws IOException {
        String name = "han";
        int age = 22;
        String gender ="男";
        String  []  otherInfo ={"河南","郑州","优胜北路"};
        Person p=new Person(name,age,gender,otherInfo);
        System.out.println(p);
        System.out.println("---------");
        FileOutputStream fos =new FileOutputStream("person.obj");
        //高级流 对象流可以将对象序列化
        ObjectOutputStream oos =new ObjectOutputStream(fos);
        //输出文件
        oos.writeObject(p);
        System.out.println("结束");
        oos.close();
    }
}
